import { fetch, postWithJson, post, del, upload,delWithJson } from '@/utils/http'

// 获取所有对象树
export function getGraph (_params) {
  return fetch('/graph/list',_params)
}


//获取树结构
export function gettree(data) {
  return post('/object/findAllWithBizGroupAsMap',data)
}

//
export function findOperateProperties(_params) {
  return fetch('/ontology/getObjectPropertiesByUri',_params)
}
// 获取该关系下的属性
export function findLinkPropertiesByUri(_params) {
  return fetch('/ontology/getLinkPropertiesByUri',_params)
}
//创建实例
export function saveExample(data) {
  return postWithJson('/instance/save',data)
}

//生成快照
export function snapshot(data) {
  return postWithJson("/relation/save/snapshot",data)
}

//获取快照
export function getSnapshot(data) {
  return fetch("/graph/list/snapshot",data)
}

//删除快照
export function deletedSnap(data) {
  return del('/graph/remove/snapshot?id='+data)
}

//根据快照ID获取快照数据
export function getSnapDataById(data) {
  return fetch("/graph/list/snapshot",data)
}

//实例详细信息
export function getdetail(data) {
  return fetch('/search/detail',data)
}

//点关联关系
export function listRelation(data) {
  return fetch('/relation/listRelation',data)
}

// 获取相关信息
export function getRelationInfo (params) {
  return fetch('/relation/listRelation', params)
}

//事件树
export function treeEvent() {
  return fetch('/object/tree/Event')
}

export function treeObject(){
  return fetch('/object/tree/Entity')
}

export function documentTree() {
  return fetch('/object/tree/Document')
}

// 根据实体类型获得实体树形结构数据
export function getObjectTreeByType (type) {
  return fetch('/object/tree/' + type)
}


// 获取可选关系
export function getOperateLinks () {
  return fetch('/ontology/findOperateLinks')
}

// 文件上传
export function uploadFile (formData) {
  return upload('/file/upload', formData)
}

//创建关系
export function saveLinkAndRelate2Objects(data) {
  return postWithJson('/ontology/saveLinkAndRelate2Objects',data)
}

export function saveEdge(data) {
  return  postWithJson("/relation/saveEdge",data)
}

export function relate2Objects(data) {
  return post('/ontology/relate2Objects',data)
}

export function removeEdge(_id) {
  return del('/relation/removeEdge?linkId='+_id)
}

export function saveOrUpdate(data) {
  return postWithJson('/graph/saveOrUpdate',data)
}

export function deleteLinkObj(data) {
  return fetch("/object/" + data.primaryId + "/instance/" + data.primaryRowkey + "/" + data.tp)
}

export function listRelationRoeKey(data) {
  return fetch("/path/relation/listRelation?rowkey=" + data.primaryRowkey + "&objectType=com.scistor.object." + data.objectType+'&objecturi='+data.objecturi)
}

export function associatenode(data) {
  return postWithJson('/case/graph/associatenode/save',data)
}

export function confirmEdge(data) {
  return postWithJson('/path/relation/confirm/edge',data)
}
export function dynamicRowkey(_rowkey) {
  return fetch("/relation/social/dynamic?rowkey="+_rowkey)
}

export function getTags(data) {
  return fetch("/social/tags/list?rowkey="+data)
}

export function groupIdList(data) {
  return fetch('/social/sub/list?groupId='+data)
}

//新增属性值
export function propertySave(data) {
  return postWithJson('/instance/property/save',data)
}

//修改属性值
export function propertyUpdate(data) {
  return postWithJson('/instance/property/update',data)
}
// 新增边属性
export function LinepropertySave(data) {
  return postWithJson('/link/propertys/save',data)
}
// 修改边属性
export function LinepropertyUpdate(data) {
  return postWithJson('/link/propertys/update',data)
}
// 删除边的属性
export function LinepropertyRemove(data) {
  return postWithJson('/link/propertys/remove',data)
}

//添加订阅实例
export function addInstance(data) {
  return postWithJson("/subscribegroup/addInstance",data)
}
// 从该分组删除
export function deleteInstance(data) {
  return delWithJson("/subscribegroup/delete/instance",data)
}

//获取实体类型和动态类型
export function groupCountFullText(data) {
  return postWithJson('/search/groupCountFullText',data)
}

//获取列表数组
export function listFullText(data) {
  return postWithJson('/search/listFullText',data)
}

//获取右击关联账号
export function filterListRelation(data) {
  return postWithJson('/path/relation/filter/listRelation',data)
}

//查询边的详情
export function getLinkDetail(params) {
  return fetch('/link/propertys/detail', params)
}

// 扩展
export function KZlistRelation(params) {
  return postWithJson('/path/relation/filter/listRelation', params)
}

